package com.lap.auth.domain.dict;

import com.lap.framework.ddd.AggregateRoot;
import java.util.List;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;

@EqualsAndHashCode(callSuper = false)
@Getter
public class DictType extends AggregateRoot {

  private final Integer id;
  private final String code;
  private Integer module;
  private String name;
  private String remark;

  @Getter(AccessLevel.NONE)
  private final List<Dict> dictList;

  public DictType(
      Integer id, String code, Integer module, String name, String remark, List<Dict> dictList) {
    this.id = id;
    this.module = module;
    this.code = code;
    this.name = name;
    this.remark = remark;
    this.dictList = dictList;
  }

  public void changeInfo(Integer module, String name, String remark) {
    this.module = module;
    this.name = name;
    this.remark = remark;
  }

  public List<Dict> getDictList() {
    return List.copyOf(dictList);
  }

  public boolean isNew() {
    return (id == null);
  }
}
